package generics;

import java.util.Arrays;

/**
 * @ClassName: MyArrayList
 * @Description: 自定义一个泛型类 实现 ArrayList 集合
 * @Author: yuanjiang
 * @Date: 2024-07-27 14:52
 **/

public class MyArrayList<E> {
    Object[] obj = new Object[10];
    int size = 0;

    public boolean add(E e){
        obj[size++] = e;
        return true;
    }

    public E get(int index){
        return (E) obj[index];
    }

    @Override
    public String toString() {
        return Arrays.toString(obj);
    }
}
